package controllayer;

import modellayer.Product;
import dblayer.PartOrderDB;
import dblayer.ProductDB;

public class ProductCTR
{
	private PartOrderDB poDB;
	private ProductDB prDB;
	
	public ProductCTR()
	{
		poDB = new PartOrderDB();
		prDB = new ProductDB();
	}
	
	public Product getProductByBarcode(String barcode)
	{
		Product p = null;
		
		if (prDB.findProductByBarcode(barcode) != null)
		{
			p = prDB.findProductByBarcode(barcode);
		}
		
		return p;
	}
	
	public void insertProduct(Product p) throws Exception
	{
		prDB.insertProduct(p);
	}
}
